Fixes image-datetime (de)-serialization#14
Merged
cjackett merged 6 commits intocsiro-fair:devfrom Apr 7, 2026
Merged
Conversation
Previously, `_check_image_item` raised a ValueError when the stored `image-datetime` string did not match `image-datetime-format`, breaking existing iFDO files where these fields were inconsistent — a common case when files were produced by tools that set `image-datetime-format` to describe the intended serialization format while Pydantic serialized the datetime as ISO 8601 regardless. The validator now catches parse failures and leaves the string unchanged, allowing Pydantic's own ISO 8601 handling to take over; tests are updated to assert this fallback behaviour.
Renamed the misspelled `check_datatime_format` ("data" + "time") to `check_datetime_format` ("date" + "time") across all call sites and exports, and corrected the companion validator method `_validate_image_datatime` to `_validate_image_datetime`.
Datetime format-aware serialization and deserialization constitutes new behaviour rather than a pure bug fix, as datetimes are now always loaded as UTC-aware objects and written in the spec-defined space-separated format instead of ISO 8601, warranting a minor version bump.
f482ad4 to
9ba951a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the default
image-datetime(de)-serialization to be aware of theimage-datetime-format. The implementation for this seems quite complex, since theimage-datetime-formatin the header is inherited as a default to items ofimage-set-items. It is also inherited from the first entry of a video item to all consecutive items.Fixes #13